﻿@model ProfileIM
@{
    ViewData["Title"] = "编辑资料";
}


<div class="container page-member">
    <div class="row">
        <div class="col-sm-4 col-md-3">
            @Html.Partial("_UserNav")
        </div>
        <div class="col-sm-8 col-md-9">

            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title">
                        <i class="iconfont icon-password"></i>
                        完善资料
                    </h3>
                </div>
                <div class="panel-body">
                    <form asp-controller="Account" asp-action="EditInfo" data-ajax-begin="onBegin" data-ajax-complete="onComplete"
                          data-ajax-failure="onFailed" data-ajax-success="onSuccess" class="form-horizontal"
                          data-ajax="true" data-ajax-method="POST">
                        @Html.AntiForgeryToken()
                        @Html.ValidationSummary(true, "", new { @class = "text-danger" })

                   


                        <div class="form-group row">
                            @Html.LabelFor(model => model.Email, htmlAttributes: new { @class = "col-form-label col-sm-3" })
                            <div class="col-sm-9">
                                @Html.EditorFor(model => model.Email, new { htmlAttributes = new { @class = "form-control" } })
                                @Html.ValidationMessageFor(model => model.Email)
                            </div>
                        </div>



                        <div class="form-group row">
                            @Html.LabelFor(model => model.RealName, htmlAttributes: new { @class = "col-form-label col-sm-3" })
                            <div class="col-sm-9">
                                @Html.EditorFor(model => model.RealName, new { htmlAttributes = new { @class = "form-control" } })
                                @Html.ValidationMessageFor(model => model.RealName)
                            </div>
                        </div>
                        <div class="form-group row">
                            @Html.LabelFor(model => model.Birthday, htmlAttributes: new { @class = "col-form-label col-sm-3" })
                            <div class="col-sm-9">

                                @Html.EditorFor(model => model.Birthday, new { htmlAttributes = new { @class = "form-control" } })
                                @Html.ValidationMessageFor(model => model.Birthday)
                            </div>
                        </div>

                        <div class="form-group row">
                            @Html.LabelFor(model => model.Gender, htmlAttributes: new { @class = "col-form-label col-sm-3" })
                            <div class="col-sm-9">
                                @Html.DropDownListFor(model => model.Gender, Html.GetEnumSelectList(typeof(Gender)), new { @class = "form-control" })
                                @Html.ValidationMessageFor(model => model.Gender)
                            </div>
                        </div>

                        <div class="form-group row">
                            @Html.LabelFor(model => model.Mobile, htmlAttributes: new { @class = "col-form-label col-sm-3" })
                            <div class="col-sm-9">
                                @Html.EditorFor(model => model.Mobile, new { htmlAttributes = new { @class = "form-control" } })
                                @Html.ValidationMessageFor(model => model.Mobile)
                            </div>
                        </div>

                        <div class="form-group row">
                            @Html.LabelFor(model => model.QQ, htmlAttributes: new { @class = "col-form-label col-sm-3" })
                            <div class="col-sm-9">
                                @Html.EditorFor(model => model.QQ, new { htmlAttributes = new { @class = "form-control" } })
                                @Html.ValidationMessageFor(model => model.QQ)
                            </div>
                        </div>


                        <div class="form-group row">

                            <div class="col-md-9 col-sm-offset-3">

                                <button class="btn btn-primary" type="submit" id="btnSave"><i class="fa fa-save fa-fw"></i>保存</button>
                                <button type="reset" class="btn btn-default">取消</button>
                            </div>
                        </div>

                    </form>
                </div>
            </div>

        </div>
    </div>
</div>

@section header{
    <link href="~/plugins/toastr/toastr.min.css" rel="stylesheet" />

}
@section footer{
    <script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
    <script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
    <script src="~/lib/jquery-ajax-unobtrusive/jquery.unobtrusive-ajax.min.js"></script>
    <script src="~/plugins/toastr/toastr.min.js"></script>
    <script>
         function onBegin() {
            $("#btnSave i").removeClass("fa-save").addClass("fa-spinner fa-spin");
        }
        function onComplete() {
            $("#btnSave i").removeClass("fa-spinner fa-spin").addClass("fa-save")
        }

        function onSuccess(data) {
            var title = "@ViewBag.Title";
             switch (data.status) {
                case 1:
                    toastr.success(data.message, title)
                    break;
                case 2:
                    toastr.error(data.message, title)
                    break;
                case 3:
                    toastr.info(data.message, title)
                    break;
                case 4:
                    toastr.warning(data.message, title)
            }
        }
        function onFailed() {
            toastr.error("操作失败！");
        }
    </script>

}